<?php
/**
 * 订单中心控制器
 * User:LLW
 * Date:2020-03-13
 */

namespace app\caidongweb\controller;

use app\caidongweb\model\OrderEvaluationModel;
use app\caidongweb\model\OrderModel;
use think\Request;

class Order extends BaseController
{
    //初始化程序
    public function __construct(Request $request)
    {
        parent::__construct();
        $this->order = new OrderModel();
        $this->ordev = new OrderEvaluationModel();
    }


    /******************************** 订单列表 ***************************************/
    /**
     * 首页
     * @return \think\response\View
     */
    public function orderList()
    {
        $state = input('state');
        $list = $this->order->getList($state);
        $this->assign('list',$list);
        $this->assign('page',$list->render());
        return view();
    }

    /**
     * 订单详情
     * @param $type
     * @return \think\response\View
     */
    public function orderFind()
    {
        $find = $this->order->getFind();
        $this->assign('find',$find);
        return view();
    }

    /**
     * 关闭待付款订单
     * @return array
     */
    public function daiSingle()
    {
        $res = $this->order->getSingle();
        return $res;
    }

    /**
     * 订单发货
     * @return array|\think\response\View
     */
    public function orderHair()
    {
        if(input('post.')){
            $res = $this->order->getHair();
            return $res;
        }else{
            $find = $this->order->getFind();
            $courier = courier();
            $this->assign('courier',$courier);
            $this->assign('find',$find);
            return view();
        }
    }

    /******************************** 评价相关 ***************************************/
    /**
     * 首页
     * @return \think\response\View
     */
    public function evaList()
    {
        $list = $this->ordev->getList();
        $this->assign('list',$list);
        $this->assign('page',$list->render());
        return view();
    }
}